package org.csu.mypetstore.persistence;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.csu.mypetstore.domain.CartItem;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface CartMapper {
    List<CartItem> getCartItemsByUsername(String username);

    CartItem getCartItem(@Param("itemId")String itemId, @Param("username")String username);

    void insertCartItem(@Param("itemId")String itemId, @Param("productId")String productId, @Param("username")String username);

    void updateCart(@Param("itemId")String itemId, @Param("username")String username, @Param("quantity")int quantity);

    void removeCartItem(@Param("itemId")String itemId, @Param("username")String username);

    void removeCart(String username);
}
